package jnpf.htgl.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jnpf.htgl.entity.ZcglHtglInfoEntity;
import jnpf.htgl.model.zcglhtglinfo.ZcglHtglPabSpaceVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 *
 * 合同管理
 * 版本： V3.2.0
 * 版权： 智果云科技（https://www.jnpfsoft.com）
 * 作者： JNPF开发平台组
 * 日期： 2025-01-12
 */
public interface ZcglHtglInfoMapper extends BaseMapper<ZcglHtglInfoEntity> {

    @Select("SELECT\n" +
            "    SUM(b.REAL_AMOUNT) AS 应收总额\n" +
            "FROM\n" +
            "    zcgl_cw_bill a \n" +
            "    LEFT JOIN zcgl_cw_bill_item b ON a.f_id = b.F_ParentId\n" +
            "WHERE\n" +
            "    YEAR(a.EXPENSE_START_DATE) < YEAR(CURRENT_DATE())\n" +
            "    AND a.CONTRACT_NO = #{htNo}")
    BigDecimal getYingShouByHtNoNowYear(String htNo);
    @Select("SELECT\n" +
            "    SUM(b.REAL_AMOUNT) AS 应收总额\n" +
            "FROM\n" +
            "    zcgl_cw_bill a \n" +
            "    LEFT JOIN zcgl_cw_bill_item b ON a.f_id = b.F_ParentId\n" +
            "WHERE\n" +
            "    YEAR(a.EXPENSE_START_DATE) = YEAR(CURRENT_DATE())\n" +
            "    AND MONTH(a.EXPENSE_START_DATE) = MONTH(CURRENT_DATE())\n" +
            "    AND a.CONTRACT_NO = #{htNo}")
    BigDecimal getYingShouByHtNoThisMonth(String htNo);
    List<ZcglHtglPabSpaceVO> getPabSpace(@Param("ids")List<String> ids);
}
